home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / com_and3.zip / CONNECT.CMD < prev    next >
OS/2 REXX Batch file  |  1989-10-09  |  3KB  |  85 lines

  1. ; ----- CONNECT: Autoanswer script
  2. ; ----------------------------------------------------------------
  3. ;    Note: This script waits for a received call.  It auto-bauds
  4. ;    according to the modem's CONNECT response.  It initializes
  5. ;    COM-AND to chat mode, CR -> CRLF, and CLOGs the fact.
  6. ; ----------------------------------------------------------------
  7. ;    Note: The hard coded autoanswer command here may need
  8. ;    recoding according to your modem.
  9. ; ----------------------------------------------------------------
  10. ;
  11. ;    Initialize
  12. ;
  13.     ON ESCAPE GOSUB EXIT        ; Escape pressed
  14.     SET PARITY NONE         ; Turn off parity
  15.     SET DATA 8            ; Set 8 databits
  16.     SET MASK ON            ; Mask received text to 7 bits
  17. ;
  18. ;    Go into auto answer (echo off, answer on 2nd)
  19. ;    .. Also: Return result codes, word form, with CONNECT 1200
  20. ;
  21. Restart:
  22.     LEGEND " Waiting for call"
  23.     Pause 3             ; Wait 3 seconds
  24.     HANGUP                ; HANGUP and leave modem in cmd mode
  25.     PAUSE 3             ; Wait 3 secs
  26.     MESSAGE "^MWaiting..."
  27.     TRANSMIT "ATE0Q0V1X1S0=2 S7=30 S9=10^M"
  28. ;
  29. ; -----------------------------------------------------------------------
  30. ; ----- Wait for a connect
  31. ; -----------------------------------------------------------------------
  32. ;
  33. Wait_Connect:
  34.     RGET S9 80 180            ; Wait for a line
  35.     IF NOT SUCCESS            ; If nothing was read
  36.        GOTO Wait_Connect
  37.        ENDIF
  38.  
  39.     FIND S9 "NO CARRIER"            ; Look for a disconn
  40.     IF FOUND
  41.        GOTO Restart
  42.        ENDIF
  43.  
  44.     FIND S9 "CONNECT"               ; Anything else BUT CONNECT
  45.     IF NOT FOUND            ; .. waits
  46.        GOTO Wait_Connect
  47.        ENDIF
  48.  
  49. ;***    IF NOT CONNECTED        ; SOme modems aren't fast enough
  50. ;***       GOTO Wait_Connect        ; .. to set this right away
  51. ;***       ENDIF
  52. ;
  53. ; -----------------------------------------------------------------------
  54. ; ----- Change baud rate according to connect
  55. ; -----------------------------------------------------------------------
  56. ;
  57.     FIND S9 "1200"                  ; Test for 1200 baud
  58.     IF FOUND            ; IF found
  59.        SET BAUD 1200        ; Set to 1200 baud
  60.        GOTO Finish            ; We're done.
  61.        ENDIF
  62.  
  63.     FIND S9 "2400"                  ; Test for 1400 baud
  64.     IF FOUND            ; IF found
  65.        SET BAUD 2400        ; Set to 1400 baud
  66.        GOTO Finish            ; We're done.
  67.        ENDIF
  68. ;
  69. ;    None of the above... set to 300
  70. ;
  71.     SET BAUD 300            ; Set to 1200 baud
  72. ;
  73. ;    Exit - set-up for conversational mode
  74. ;
  75. Finish:
  76.     SET CHAT ON            ; Set chat mode
  77.     SET CR CR_LF            ; Incoming Cr's as CRLF
  78.     CLOG "* Auto-answer"            ; Log it
  79.     ALARM                ; Sound alarm
  80. ;
  81. ;    The exit is separately labelled to allow ESC to terminate quickly
  82. ;
  83. Exit:
  84.     EXIT
  85.